package cn.edu.hnit.javaee.experiments.experiment01.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


import cn.edu.hnit.javaee.experiments.experiment01.dao.StudentDao;
import cn.edu.hnit.javaee.experiments.experiment01.model.StudentPOJO;

public class StudentServiceImpl {
	
	private StudentDao studentDao;

	public List<StudentPOJO> getPage(int page, StudentPOJO studentPOJO) {

		int pageSize = 10;
		int currentPageNo = (page-1)*pageSize;
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("currentPageNo",currentPageNo);
		params.put("pageSize",pageSize);
		params.put("student", studentPOJO);
		return studentDao.getPage(params);

	}
	
	public int getCount() {
		return studentDao.getCount();
	}
	
	public int addBatch(List<StudentPOJO> students) {
		return studentDao.addBatch(students);
	}
	
	public int updateById(StudentPOJO student) {
		return studentDao.updateById(student);
	}
	
	public int deleteBatch(List<String> ids) {
		return studentDao.deleteBatch(ids);
	}

	public StudentDao getStudentDao() {
		return studentDao;
	}

	public void setStudentDao(StudentDao studentDao) {
		this.studentDao = studentDao;
	}
	
}
